package com.zookeeper.te2;

import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;

/**
 * 作者: LCG
 * 日期: 2019/9/17 11:19
 * 描述:
 */
public class MyWatcher01 implements Watcher {
    @Override
    public void process(WatchedEvent event) {

        if(Event.EventType.NodeCreated.getIntValue()==event.getType().getIntValue()){
            System.out.println("=======创建了一个节点======"+event.getPath());
        }else if(Event.EventType.NodeDeleted.getIntValue()==event.getType().getIntValue()){
            System.out.println("=======删除一个节点======"+event.getPath());
        }else if(Event.EventType.NodeDataChanged.getIntValue()==event.getType().getIntValue()){
            System.out.println("============节点的数据更新========"+event.getPath());
        }else if(Event.EventType.NodeChildrenChanged.getIntValue()==event.getType().getIntValue()){
            System.out.println("============子节点数据发生变化========");
        }else if(Event.EventType.None.getIntValue()==event.getType().getIntValue()){
            System.out.println("====================");
        }


    }
}
